|
A common ICMP control message is the ICMP
redirect/change request. This type of message can only be initiated by
a gateway, which is a term commonly used to describe a router. All
hosts that communicate with multiple IP networks must be configured
with a default gateway. This default gateway is the address of a
router port connected to the same network as the host. Figure
displays a
host connected to a router that has access to the Internet. Once
configured with the IP address of Fa 0/0 as its default gateway, Host
B uses that IP address to reach any network not directly connected to
it. Normally, Host B is connected to a single gateway. However, in
some circumstances, a host connects to a segment that has two or more
directly connected routers. In this case, the default gateway of the
host may need to use a redirect/change request to inform the host of
the best path to a certain network.
Figure
shows a
network where ICMP redirects would be used. Host B sends a packet to
Host C on network 10.0.0.0/8. Since Host B is not directly connected
to the same network, it forwards the packet to its default gateway,
Router A. Router A finds the correct route to network 10.0.0.0/8 by
looking into its route table. It determines that the path to the
network is back out the same interface the request to forward the
packet came from. It forwards the packet and sends an ICMP
redirect/change request to Host B telling it to use Router B as the
gateway to forward all future requests to network 10.0.0.0/8.
Default gateways only send ICMP
redirect/change request messages if the following conditions are met:
- The interface on which the packet
comes into the router is the same interface on which the packet gets
routed out.
- The subnet/network of the source IP
address is the same subnet/network of the next-hop IP address of the
routed packet.
- The datagram is not source-routed.
- The route for the redirect is not
another ICMP redirect or a default route.
- The router is configured to send
redirects. (By default, Cisco routers send ICMP redirects. The
interface subcommand no ip redirects will disable ICMP
redirects.)
The ICMP redirect/change request uses
the format shown in Figure
. It has an
ICMP type code of 5. In addition, it has a code value of 0, 1, 2, or
3. 
The Router Internet Address field in
the ICMP redirect is the IP address that should be used as the default
gateway for a particular network. In the example in Figure
, the ICMP
redirect sent from Router A to Host B would have a Router Internet
Address field value of 172.16.1.200, which is the IP address of E0 on
Router B.
|